package com.ddxz.tool.core.exception;

import com.ddxz.tool.core.common.DdxzStatus;
import com.ddxz.tool.core.convert.StringUtil;

/**
 * @author 朱宗刚
 * @version 1.0.0
 * description com.casic.exchange.com.casic.common.tools.dto.CasicException
 * @date 2020/2/28
 */
public class DdxzBaseException extends RuntimeException {
    static final long serialVersionUID = 820200727151501L;

    public DdxzBaseException(DdxzStatus status, Object... args) {
        super(StringUtil.getMessage(status.getMessage(), args));
        this.status = status.getStatus();
    }

    public DdxzBaseException(DdxzStatus status, String msg, Object... args) {
        super(StringUtil.getMessage(msg, args));
        this.status = status.getStatus();
    }

    public DdxzBaseException(Throwable throwable, DdxzStatus status, Object... args) {
        super(StringUtil.getMessage(status.getMessage(), args), throwable);
        this.status = status.getStatus();
    }

    public DdxzBaseException(Throwable throwable, DdxzStatus status, String msg, Object... args) {
        super(StringUtil.getMessage(msg, args), throwable);
        this.status = status.getStatus();
    }

    public Integer getStatus() {
        return status;
    }

    private Integer status;
}
